//Cli.cpp : Defines the entry point for the console application.
//
#if _MSC_VER >1000
#pragma once
#endif //_MSC_VER > 1000

#include<vector>
using namespace std;
class GenDataObjectClass
{
public:
	GenDataObjectClass(){}
	virtual~GenDataObjectClass(){}
	char DOName[32];
	char DORef[64];
};

class GenLogicalNodeClass
{
public:
	GenLogicalNodeClass(){}
	virtual~GenLogicalNodeClass(){}
	char LNName[32];
	char LNRef[64];
	vector<GenDataObjectClass *>m_LNs;
};
class GenLogicalDeviceClass
{
public:
	GenLogicalDeviceClass(){}
	virtual~GenLogicalDeviceClass(){}
	vector<GenLogicalNodeClass *>m_dos;
	char LDName[32];
	char LDRef[64];
};
class IED
{
public:
	IED(){}
	virtual~IED(){}
	GenLogicalDeviceClass * m_pLD;
	void init();
};

class MV : public GenDataObjectClass
{
public:
	float magSf;
};
class MMXN : public GenLogicalNodeClass
{
public:
	MV Amp;
	MV Vol;
	MV Watt;
};

class DPG : public GenDataObjectClass
{
public:
	enum DbposEnum
	{
		intermediate,off,on,bad
	};
	DbposEnum stVal;

	char * stVal2string()
	{
		if(stVal==intermediate)return"intermediate";
		else if (stVal==off)return"off";
		else if (stVal==on)return "on";
		else if (stVal==bad)return"bad";
		return "";
	}
};

class XCBR :public GenLogicalNodeClass
{
public:
	XCBR()
	{
		m_LNs.push_back(&Pos);
	}
	DPG Pos;
};

class MyLD : public GenLogicalDeviceClass
{
public:
	MyLD()
	{
		m_dos.push_back(&XCBR1);
		m_dos.push_back(&MMXN1);
	}
	virtual~MyLD(){}
	XCBR XCBR1;
	MMXN MMXN1;
};

#if 0
IED::IED()
{

}

IED::~IED()
{

}
#endif
void IED::init()
{
	MyLD *p = new MyLD;
    m_pLD = p;

	p->MMXN1.Amp.magSf =10;
	p->MMXN1.Vol.magSf =220;
	p->MMXN1.Watt.magSf =2000;
	p->XCBR1.Pos.stVal = DPG::on;
}